public class Solution237 {
    public void deleteNode(ListNode node) {
        /*
        ListNode p = node.next;
        while (p.next != null) {
            node.val = p.val;
            node = p;
            p = p.next;
        }
        node.val = p.val;
        node.next = null;
        */
        node.val = node.next.val;
        if (node.next.next == null) {
            node.next = null;
            return;
        }
        deleteNode(node.next);
    }
}
